<?php

/***
** 学校model
*/
class School_model extends CI_Model{

 	function __construct(){
    	parent::__construct();
	}

  /**
  ** 获取学校信息
  */
  function get_school_by_id($id){
    $sql = "SELECT * FROM {$this->db->dbprefix}o2o_school where id = {$id} limit 1";
    return $this->db->query($sql)->row_array();
  }

   /**
   * 获取校区
   * @param  [type] $school_id [description]
   * @return [type]            [description]
   */
  public function get_school_campus($school_id)
  {
    $sql = "SELECT * FROM {$this->db->dbprefix}o2o_school_campus where school_id = {$school_id} ";
    return $this->db->query($sql)->result_array();
  }

  /**
   * 获取首页展示的老师list
   * @param  [type] $limit [description]
   * @return [type]        [description]
   */
  function get_teacher_list($limit=6){
    $sql = "SELECT * FROM {$this->db->dbprefix}o2o_teachers where school_id = $this->school_id limit $limit ";
    return $this->db->query($sql)->result_array();
  }

   function get_school_campus_by_id($school_campus_id){
    $sql = "SELECT * FROM {$this->db->dbprefix}o2o_school_campus where id = {$school_campus_id} ";
    return $this->db->query($sql)->row_array();
  }
  
}
